#!/usr/bin/python
import cgitb
cgitb.enable()

import cgi , urllib, time,os

def get_precent_time():
	my_data =  time.localtime()
	return ' %d/%d/%d %d:%d:%d <P>' %(my_data[0],my_data[1],my_data[2],my_data[3],my_data[4],my_data[5])

print "Content-type: text/html"
print

print """
<HTML>
<HEAD>
<TITLE>LIST CHOOSE</TITLE></HEAD>
<BODY>"""

get_precent_time()

form = cgi.FieldStorage()
print "you select : <p>"
selection = form.getlist('data')

printable = [cgi.escape(x) for x in selection ]
print ",".join(printable)

print """
<FORM METHOD="GET" ACTION="%s">
select some: <p>""" %os.environ['SCRIPT_NAME']

for item in ['red','green','yellow','blue','black','white','purple','python','perl','Lisp','java','c++','c','ruby']:
	print '<INPUT TYPE="checkbox" NAME="data" VALUE="%s" >' % cgi.escape(item)
	print '%s<BR>' % cgi.escape(item)

print """
<INPUT TYPE="submit" NAME="submit" VALUE="Submit" >
</FORM></BODY></HTML>
"""
